Skip to main content

MoreFun Device Properties Configuration

The MoreFun SmartPOS SDK allows you to configure various device properties directly from your application, including kiosk mode and permissions.

Configuration

Warning

  • The device properties configuration must be called after initializing the SDK with SDKPayments.init(). Attempting to configure properties before SDK initialization will result in a runtime exception.
  • During a transaction: You cannot configure device properties while a transaction is in progress. The configuration will return SDKMoreFunPropertiesConfigurationResult.Fail.ReaderBusy.
  • During configuration: You cannot start a transaction while properties are being configured. The transaction creation will fail, and you will receive a SDKTransactionIntentResult.Error in the onTransactionCreated() callback with the message indicating that device properties are being configured.
  • Multiple configurations: Even though the configuration interface can hold multiple sets of properties, applying them simultaneously is not guaranteed to work correctly. You must perform separate configure calls sequentially. For instance, you should first configure Kiosk mode, and only upon its completion, proceed to configure the permissions.

Always ensure that no transaction is active before configuring properties, and wait for configuration to complete before starting a new transaction. :::

Basic Implementation

To configure MoreFun device properties, use the SDKMoreFunReader.configurator:

import com.geopagos.reader.morefun.SDKMoreFunPropertiesConfiguration
import com.geopagos.reader.morefun.SDKMoreFunPropertiesConfigurationResult
import com.geopagos.reader.morefun.SDKMoreFunReader

// Create the Map with configuration properties
val properties = mapOf(
"KIOSK_MODE_ENABLE" to true,
"KIOSK_MODE_PACKAGE" to "com.your.application",
"KIOSK_MODE_PASSWORD" to "your_password"
)

// Configure device properties
SDKMoreFunReader.configurator.configure(
SDKMoreFunPropertiesConfiguration(properties)
) { result ->
when (result) {
is SDKMoreFunPropertiesConfigurationResult.Success -> {
// Properties configured successfully
println("Device properties configured successfully")
}
is SDKMoreFunPropertiesConfigurationResult.Fail.ReaderBusy -> {
// The reader is currently busy with another operation
// This can happen if:
// - A transaction is in progress
// - Another configuration is being processed
// Wait and retry after the current operation completes
println("Reader is busy - retry later")
}
is SDKMoreFunPropertiesConfigurationResult.Fail.Error -> {
// An error occurred during configuration
// This can happen if:
// - Invalid properties were provided
// - Device communication failed
// - Insufficient permissions
println("Error configuring device properties")
}
}
}

Configuration Results

The configure method returns one of three possible results through the callback:

Success

SDKMoreFunPropertiesConfigurationResult.Success

The device properties configuration was applied successfully. The device is now configured with the provided properties.

Reader Busy

SDKMoreFunPropertiesConfigurationResult.Fail.ReaderBusy

The reader is currently busy and cannot process the configuration. This happens when:

  • A transaction is in progress: Wait for the transaction to complete before configuring properties
  • Another configuration is being processed: Wait for the current configuration to finish

Error

SDKMoreFunPropertiesConfigurationResult.Fail.Error

An error occurred during the configuration process. Possible causes:

  • Invalid properties in the Bundle
  • Device communication failure
  • Insufficient permissions on the device
  • Incorrect values for the properties

Common Use Cases

Kiosk Mode Configuration

Enable kiosk mode to lock the device to your application:

val kioskProperties = mapOf(
"KIOSK_MODE_ENABLE" to true,
"KIOSK_MODE_PACKAGE" to "com.your.application",
"KIOSK_MODE_PASSWORD" to "your_password"
)

SDKMoreFunReader.configurator.configure(
SDKMoreFunPropertiesConfiguration(kioskProperties)
) { result ->
// Handle result
}

Disabling Kiosk Mode

To disable kiosk mode:

val properties = mapOf(
"KIOSK_MODE_DISABLE" to true,
"KIOSK_MODE_PACKAGE" to "com.your.application"
)

SDKMoreFunReader.configurator.configure(
SDKMoreFunPropertiesConfiguration(properties)
) { result ->
// Handle result
}

Granting Permissions

You can optionally grant permissions to your application:

val permissions = arrayOf(
android.Manifest.permission.READ_EXTERNAL_STORAGE,
android.Manifest.permission.WRITE_EXTERNAL_STORAGE
)

val properties = mapOf(
"GRANT_PERMISSION" to true,
"GRANT_PERMISSION_PACKAGENAME" to "com.your.application",
"GRANT_PERMISSION_PERMISSIONLIST" to permissions
)

SDKMoreFunReader.configurator.configure(
SDKMoreFunPropertiesConfiguration(properties)
) { result ->
// Handle result
}

Available Properties

The configuration Map accepts any property supported by the MoreFun YSDK. Below are the commonly used properties:

Kiosk Mode Properties

PropertyTypeDescription
KIOSK_MODE_ENABLEBooleanEnables kiosk mode
KIOSK_MODE_DISABLEBooleanDisables kiosk mode
KIOSK_MODE_PACKAGEStringApplication package name
KIOSK_MODE_PASSWORDStringPassword to exit kiosk mode

Optional Permission Properties

PropertyTypeDescription
GRANT_PERMISSIONBooleanEnable permission granting
GRANT_PERMISSION_PACKAGENAMEStringPackage name to grant permissions to
GRANT_PERMISSION_PERMISSIONLISTString[]Array of permissions to grant